﻿CREATE PROCEDURE [dbo].[Hogar_Actividad_ObtenerInscripciones] 
AS 
BEGIN

/*****************************************************************************************************************************************/
-- Author: Carlos Mendoza
-- Purpose:   obtener todas las inscripciones existentes
-- Returns:    ConsultaInscripcion
/*****************************************************************************************************************************************/ 
	
		SELECT [Nombre] AS [Actividad], 
			   [IntegranteId], 
			   i.[ActividadId], 
			   CASE WHEN YEAR([FechaInscripcion]) = 1900 THEN NULL ELSE [FechaInscripcion] END AS [FechaInscripcion],
			   CASE WHEN i.[Activa] = 0 THEN 0 ELSE 1 END AS [Activa],
			   i.[FechaBaja]
		FROM [dbo].[Inscripcion] i WITH (NOLOCK)
		INNER JOIN [dbo].[Actividad] a WITH (NOLOCK) ON a.[ActividadId] = i.[ActividadId]
		WHERE YEAR([FechaInscripcion]) = YEAR(GETDATE())
		ORDER BY i.[ActividadId]
	
END